package com.metaverse.backend.service;

import com.metaverse.backend.domain.User;
import com.metaverse.backend.dto.UserRegister;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.Set;

/**
 * 注册统一处理
 */
@Service
@Slf4j
@AllArgsConstructor
public class UserRegisterService {
    private UserService userService;



    /**
     * 通过openid注册
     * @param openid
     * @return
     */
    public User registerByOpenId( String openid){
        UserRegister userRegister = new UserRegister();
        userRegister.setOpenid(openid);
//        userRegister.setPassword("123456");
        userRegister.setAdmin(false);
        User user = userService.create(userRegister);
        return user;
    }



}
